package String;

public class StringAndStringBuilderDemo {
    public static void main(String[] args) {
     /*   StringBuilder s=new StringBuilder("a");
        for (int i = 0; i < 10000000; i++) {
            s.append(i);
        }
        System.out.println("完毕");

      */




        StringBuilder s=new StringBuilder("a");
        for (int i = 0; i < 10000000; i++) {
            s.append(i);
        }
        System.out.println("执行完毕");













      /*  //String不适合频繁修改内容（效率低）
        String s="a";
        for (int i = 0; i < 100000; i++) {
            s=s+1;//每次修改都会在内存中分配新的对象
        }
        System.out.println("执行完毕");


       */
    }
}
